package org.framework.common.ext.util.datasource;

import org.framework.common.ext.util.StringUtil;

public class DynamicDataSourceHolder {
	private static final ThreadLocal<String> LOCAL = new ThreadLocal<String>();
	
	public static final String DEFAULT = "default"; 

	public static void setDataSource(final String dataSource) {
		LOCAL.set(StringUtil.isEmpty(dataSource) ? DEFAULT : dataSource);
	}

	public static String getDataSource() {
		return LOCAL.get();
	}

	public static void clear() {
		LOCAL.remove();
	}
}
